package com.px.idal;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.px.model.CompanyInfo;

public interface ICompanyInfoMapper {
	/**
	 * 查询方法
	 * 查询所有参加会员单位
	 * 使用@Select 注解指明getAllUsers方法要执行的SQL
	 * */
	@Select("select * from company_info_tb")
	public List<CompanyInfo> getAllCompanyInfos();
	
	//按照id查
	@Select("select * from company_info_tb where company_id=#{company_id}")
	public List<CompanyInfo> getCompanyInfoByCompanyInfoId(CompanyInfo company);


	/**
	 * Insert方法
	 * 增加参加会员单位
	 * 传参为对象方法
	 * */
	@Insert("insert into company_info_tb (company_name,company_tip ) value(#{company_name},#{company_tip})")
	public int insertCompanyInfos(CompanyInfo company);

	/**
	 * 更新方法
	 * 更新指定company_id的参加会员单位的名称和介绍
	 * */
	@Update("update company_info_tb  set company_name=#{company_name},company_tip=#{company_tip} where company_id=#{company_id}")
	public int updateCompanyInfoByCompanyInfoId(CompanyInfo company);

	/**
	 * 删除方法
	 * 删除指定company_id的参加会员单位
	 * 示例
	 * */
	@Delete("delete from company_info_tb where company_id=#{company_id}")
	public int deleteCompanyInfoByCompanyInfoId(Integer company_id);

	/**
	 * 查询参加会员单位信息总条数
	 * 
	 * */
	@Select("select count(*) from company_info_tb")
	public int getAllCompanyInfoCounts();

	/**
	 * 查询指定参加会员单位名参加会员单位是否存在
	 * 
	 * */
	@Select("select count(*) from company_info_tb where company_id=#{company_id}")
	public int checkCompanyInfoIdIsExist(CompanyInfo company);
}
